package esmodel

var SpiderESIndex = "spider"

// SpiderESModel represents the spider data model in Elasticsearch
type SpiderESModel struct {
	SpiderId           int32                      `json:"spider_id"`
	Content            string                     `json:"content"`
	CreatedTime        int32                      `json:"created_time"`
	SpiderGoodsConvery []SpiderCoveryGoodsESModel `json:"spider_goods_convery"`
}

// SpiderCoveryGoodsESModel represents the goods data model in Elasticsearch
type SpiderCoveryGoodsESModel struct {
	GoodsId   int32  `json:"goods_id"`
	GoodsName string `json:"goods_name"`
}

// Spider index properties
var SpiderESProperties = map[string]any{
	"spider_id":    map[string]string{"type": "integer"},
	"content":      map[string]string{"type": "text"},
	"created_time": map[string]string{"type": "integer"},
	"spider_goods_convery": map[string]any{
		"type":       "nested",
		"properties": SpiderGoodsConveryProperties,
	},
}

// Spider goods convery properties
var SpiderGoodsConveryProperties = map[string]any{
	"goods_id":   map[string]string{"type": "integer"},
	"goods_name": map[string]string{"type": "text"},
}

// var SpiderESMapping elasticsearch.IndexMapping = elasticsearch.indexMap.ESIndexMapping
// SpiderESMapping.Mappings.Properties = SpiderESProperties
